﻿package net.wangit.framework.validation;

import net.wangit.LabelUtil;
import net.wangit.context.ActionContext;
import net.wangit.support.Validator;
import net.wangit.util.Checker;

public class EmailValidator
	implements Validator
{

	public EmailValidator()
	{
	}

	public String validate(ActionContext ac, String value, String expression, int rowIndex)
	{
		if (Checker.isEmpty(value))
			return null;
		if (!org.apache.commons.validator.EmailValidator.getInstance().isValid(value))
			return LabelUtil.get(ac, "system", "validation.invalid_email");
		else
			return null;
	}

	public String validate(ActionContext ac, String from, String to, String s)
	{
		return null;
	}
}
